// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import * as utils from './utils'
import request from './request'
import 'babel-polyfill'
import axios from 'axios'

Vue.use(ElementUI)
// 挂载全局参数与方法
Vue.prototype.$utils = utils
Vue.prototype.$request = request
Vue.config.productionTip = false
require('./assets/less/common.less')
async function getConfigJson () {
  await axios.get('serverconfig.json').then((result) => {
    console.log('read from json', result)
    window.localStorage.setItem('serverHost', result.data.serverHost)
    window.localStorage.setItem('clientId', result.data.clientId)
  }).catch((error) => {
    window.localStorage.setItem('serverHost', 'https://192.168.254.98:6100')
    window.localStorage.setItem('clientId', 'A994F2252DAAB9BC56504A9575EAB6F3')
    console.log(error)
  })// eslint-disable-next-line
  new Vue({
    el: '#app',
    router,
    components: {App},
    template: '<App/>'
  })
}
getConfigJson()
